package com.ican.domain.product;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.ican.domain.common.BaseEntity;

@Entity
@Table(name="t_product")
public class Product extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private Integer categoryId;
    private String name;
    private String code;
    private String price;
    private String priceUnit;
    private String weight;
    private String weightUnit;
    private String description;
    private Integer langId;
    
    private String url;
    private String urlFlag;
    private Integer ruleId;
    private Date ncTime;
    private Integer ncStatus;//0： 未运行；1：运行中；2：运行成功；3：运行失败
    private Date synTime;
    private Integer synStatus;//0：没有同步；1：同步中；2：同步成功；3：同步失败
    private Integer synProductId;
    
    private Category category;
    private List<ProductImage> images;
    private List<ProductAttribute> attrs;

    @Column(name="category_id")
    public Integer getCategoryId() {
        return categoryId;
    }
    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }
    @Column(name="name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name="code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name="price")
    public String getPrice() {
        return price;
    }
    public void setPrice(String price) {
        this.price = price;
    }
    @Column(name="price_unit")
    public String getPriceUnit() {
        return priceUnit;
    }
    public void setPriceUnit(String priceUnit) {
        this.priceUnit = priceUnit;
    }
    @Column(name="weight")
    public String getWeight() {
        return weight;
    }
    public void setWeight(String weight) {
        this.weight = weight;
    }
    @Column(name="weight_unit")
    public String getWeightUnit() {
        return weightUnit;
    }
    public void setWeightUnit(String weightUnit) {
        this.weightUnit = weightUnit;
    }
    @Column(name="description")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name="lang_id")
    public Integer getLangId() {
        return langId;
    }
    public void setLangId(Integer langId) {
        this.langId = langId;
    }
    @Column(name="url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name="url_flag")
    public String getUrlFlag() {
        return urlFlag;
    }
    public void setUrlFlag(String urlFlag) {
        this.urlFlag = urlFlag;
    }
    @Column(name="rule_id")
    public Integer getRuleId() {
        return ruleId;
    }
    public void setRuleId(Integer ruleId) {
        this.ruleId = ruleId;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "nc_time", length = 19)
    public Date getNcTime() {
        return ncTime;
    }
    public void setNcTime(Date ncTime) {
        this.ncTime = ncTime;
    }
    @Column(name="nc_status")
    public Integer getNcStatus() {
        return ncStatus;
    }
    public void setNcStatus(Integer ncStatus) {
        this.ncStatus = ncStatus;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "syn_time", length = 19)
    public Date getSynTime() {
        return synTime;
    }
    public void setSynTime(Date synTime) {
        this.synTime = synTime;
    }
    @Column(name="syn_status")
    public Integer getSynStatus() {
        return synStatus;
    }
    public void setSynStatus(Integer synStatus) {
        this.synStatus = synStatus;
    }
    @Column(name="syn_product_id")
    public Integer getSynProductId() {
        return synProductId;
    }
    public void setSynProductId(Integer synProductId) {
        this.synProductId = synProductId;
    }

    @Transient
    public Category getCategory() {
        return category;
    }
    public void setCategory(Category category) {
        this.category = category;
    }
    @Transient
    public List<ProductImage> getImages() {
        return images;
    }
    public void setImages(List<ProductImage> images) {
        this.images = images;
    }
    @Transient
    public List<ProductAttribute> getAttrs() {
        return attrs;
    }
    public void setAttrs(List<ProductAttribute> attrs) {
        this.attrs = attrs;
    }
}
